#include "Shm.hpp"
#include "Fifo.hpp"

int main()
{
    Shm shm(pathname, projid, CREATER);
    sleep(5);
    shm.Attr();

    NamedFifo fifo(PATH, FILENAME);

    // 文件操作
    FileOper readerfile(PATH, FILENAME);
    readerfile.OpenForRead();

    char* mem =  (char*)shm.VirtualAddr();
    //读写共享内存，没有使用系统调用
    while(true)
    {
        if(readerfile.Wait())
        {
            printf("%s\n", mem);
        }
        else
        {
            break;
        }
    }
    readerfile.Close();
    cout << "server end normal!" << endl;
    return 0;
}